//? 模拟请求
function tryReq(fn,time) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            //? resolve一个函数过去
            resolve(fn)
        },time)
    })
}

function fn() {
    console.log('请求成功')
}
function fn2() {
    console.log('请求失败')
}
function out(promises) {
    //? race来执行最快那个的resolve的fn 不用函数也可以直接resolve('xxxx')
    return Promise.race(promises).then(res => res(),err => err())
}
const promises = [tryReq(fn,3000),tryReq(fn2,1000)]
out(promises)
